<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->

<head>
<meta charset="utf-8">


<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- Bootstrap Stylesheet -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" media="screen">
<!-- Theme Stylesheet -->
<link rel="stylesheet" href="assets/css/dandelion.theme.css" media="screen"-->
<!-- Icon Stylesheet -->
<link rel="stylesheet" href="assets/css/fonts/glyphicons/style.css" media="screen">
<!--  Main Stylesheet -->
<link rel="stylesheet" href="assets/css/dandelion.css" media="screen">
<!-- Sistem Stylesheet -->
<link rel="stylesheet" href="sistem/css/style.css" media="screen">
<!-- Plugin Stylesheet -->
<link rel="stylesheet" href="assets/js/plugins/wizard/dandelion.wizard.css" media="screen">
<link rel="stylesheet" type="text/css" href="assets/jqplot/jquery.jqplot.min.css" />

<link type="text/css" rel="stylesheet" href="assets/jqplot/syntaxhighlighter/styles/shCoreDefault.min.css" />
<link type="text/css" rel="stylesheet" href="assets/jqplot/syntaxhighlighter/styles/shThemejqPlot.min.css" />

<link rel="shortcut icon" href="favicon.png" />

<title>SIPKAN Surabaya &raquo; <?php if(defined('SUBPAGE')){ echo SUBPAGE; } elseif(defined('PAGE')) { echo PAGE; } else {echo 'Beranda'; } ?></title>

</head>

<body>

<!-- Main Wrapper. Set this to 'fixed' for fixed layout and 'fluid' for fluid layout' -->
<div id="da-wrapper">
	
<!-- Header -->
<div id="da-header">
		
	<div id="da-header-top">
				
		<!-- Container -->
		<div class="da-container clearfix">
					
			<!-- Logo Container. All images put here will be vertically centere -->
			<div id="da-logo-wrap">
				<div id="da-logo">
					<div id="da-logo-img">
						<a href="beranda.php">
							<!--img src="assets/images/logo.png"/ ; logo yg mau dihapus -->
						</a>
					</div>
				</div>
			</div>
					
			<!-- Header Toolbar Menu -->
			<div id="da-header-toolbar" class="clearfix">
				<div id="da-user-profile-wrap">
					<div id="da-user-profile" data-toggle="dropdown" class="clearfix">
						<div id="da-user-avatar">
							<img src="sistem/images/pp.png" alt="">
						</div>
						<div id="da-user-info">
							<?php echo strtoupper(NAMA); ?>
							<span class="da-user-title"><?php echo strtoupper(LEVEL);?></span>
						</div>
					</div>
					<ul class="dropdown-menu">
						<li><a href="beranda.php">Beranda</a></li>
						<li class="divider"></li>
						<li><a href="profil.php">Profil</a></li>
						<li><a href="pengaturan.php">Pengaturan</a></li>
						<li><a href="">Ubah Kata Sandi</a></li>
					</ul>
				</div>
				<div id="da-header-button-container">
					<ul>
						<?php if(LEVEL!="sekretariat") {?>
							
							<?php if(LEVEL=="jaksa") {?>
							
							<li class="da-header-button-wrap">
								<div class="da-header-button" data-toggle="dropdown">
									<?php 
										$date = date("Y-m-d");// current date

										$date_14 = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " -14 day"));
										$date_30 = date("Y-m-d", strtotime(date("Y-m-d", strtotime($date)) . " -30 day"));
										
										$q_30=mysql_query("select * from t_jaksa_aktifitas where tanggal < '$date_30' and posisi!='p21' and kd_pegawai =".ID_PEGAWAI."");
										$jlh	= mysql_num_rows($q_30);
										$q_14=mysql_query("select * from t_jaksa_aktifitas where tanggal < '$date_14' and (posisi='p18' or posisi='p19') and kd_pegawai =".ID_PEGAWAI."");
										$jlh = $jlh+mysql_num_rows($q_14);
									?>
									<span class="btn-count"><?php echo ($jlh>0)?$jlh:'0'; ?></span>
									<a href="#"><i class="icon-circle-exclamation-mark"></i></a>
								</div>
								<ul class="dropdown-menu pull-right">
									<li>
										<span class="da-dropdown-sub-title">Perhatian</span>
										<ul class="da-dropdown-sub">
										<?php 
											while($dt_14 = mysql_fetch_array($q_14)) {
										?>
											<li class="unread">
												<?php
													$href = "perkara.detail.php?kd=".$dt_14['kd_perkara']; 
													if($dt_14['posisi']!=null){
														$href = $href."&p=".strtolower($dt_14['posisi']);
													}
												?>
												<a href="<?php echo $href;?>">
													<span class="info">			
														<span class="message">
															<?php 
																echo $dt_14['kd_perkara']." di ".$dt_14['posisi']." (14 hari)";
																
															?>
														</span>
														<span class="time">
															<?php echo konversi_tanggal('d-m-Y',$dt_14['tanggal']) ?>
														</span>
													</span>
												</a>
											</li>
										<?php } ?>
										<?php 
											while($dt_30 = mysql_fetch_array($q_30)) {
										?>
											<li class="unread">
												<?php
													$href = "perkara.detail.php?kd=".$dt_30['kd_perkara']; 
													if($dt_30['posisi']!=null){
														$href = $href."&p=".strtolower($dt_30['posisi']);
													}
												?>
												<a href="<?php echo $href;?>">
													<span class="info">			
														<span class="message">
															<?php 
																echo $dt_30['kd_perkara']." di ".$dt_30['posisi']." (30 hari)";
																
															?>
														</span>
														<span class="time">
															<?php echo konversi_tanggal('d-m-Y',$dt_30['tanggal']) ?>
														</span>
													</span>
												</a>
											</li>
										<?php } ?>

										
										</ul
									</li>
								</ul>
							</li>
							
							<?php }?>
							<li class="da-header-button-wrap">
								<div class="da-header-button" data-toggle="dropdown">
									<?php 
										if(LEVEL=="superadmin" || LEVEL=="admin") {
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' and isnull(kd_pegawai) order by waktu desc");
										} else if(ID_PEGAWAI==""){
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' AND kd_pengguna='".ID."' order by waktu desc");
										}else{
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' AND kd_pegawai='".ID_PEGAWAI."' order by waktu desc");
										}							
										$jlh	= mysql_num_rows($q);
										if(LEVEL=="superadmin" || LEVEL=="admin") {
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' and isnull(kd_pegawai) order by waktu desc limit 5 ");
										} else if(ID_PEGAWAI==""){
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' AND kd_pengguna='".ID."' order by waktu desc limit 5");
										}else{
											$q = mysql_query("SELECT * FROM t_pemberitahuan WHERE terbaca='t' AND kd_pegawai='".ID_PEGAWAI."' order by waktu desc limit 5");
										}
									?>
									<span class="btn-count"><?php echo ($jlh>0)?$jlh:'0'; ?></span>
									<a href="#"><i class="icon-envelope"></i></a>
								</div>
								<ul class="dropdown-menu pull-right">
									<li>
										<span class="da-dropdown-sub-title">Pemberitahuan</span>
										<ul class="da-dropdown-sub">
										<?php 
											while($dt = mysql_fetch_array($q)) {
												$isi = explode('=>',$dt['pemberitahuan']);
										?>
											<li class="unread">
												<?php
													if(ID_PEGAWAI==""){
														$href = "perkara.detail.php?kd=".$isi[1]; 
														if($dt['posisi']!=null){
															$href = $href."&p=".$dt['posisi'];
														}
													}else{
														$href = "perkara.detail.php?kd=".$isi[1]; 
													}
												?>
												<a href="modul/pemberitahuan/pemberitahuan_redirect.php?id=<?php echo $dt['kd_pemberitahuan']?>&url=<?php echo $href;?>">
													<span class="info">			
														<span class="message">
															<?php 
																if(count($isi)>1){
																	echo $isi[0]." dengan kode perkara ".$isi[1];
																}else{
																	echo $dt['pemberitahuan'];
																}
															?>
														</span>
														<span class="time">
															<?php echo konversi_tanggal('d-m-Y H:i:s',$dt['waktu']) ?>
														</span>
													</span>
												</a>
											</li>
										<?php } ?>

										
										</ul>
										<a class="da-dropdown-sub-footer" href="pemberitahuan.php">
										Lihat semua pemberitahuan
										</a>
									</li>
								</ul>
							</li>
						<?php } ?>
						<li class="da-header-button-wrap">
							<div class="da-header-button">
								<a href="logout.php"><i class="icon-power"></i></a>
							</div>
						</li>
					</ul>
				</div>
			</div>
									
		</div>
	</div>
			
	<div id="da-header-bottom">
		<!-- Container -->
		<div class="da-container clearfix">
				
			<div id="da-search">
				<form>
					<input type="text" class="search-query" placeholder="Pencarian...">
				</form>
			</div>
					
			<!-- Breadcrumbs -->
			<div id="da-breadcrumb">
				<ul>
					<li<?php if(!defined('PAGE')) { echo ' class="active"'; } ?>><a href="beranda.php"><i class="icon-home"></i> Beranda</a></li>
					<?php if(defined('PAGE')) { ?>
					<li<?php if(!defined('SUBPAGE')) { echo ' class="active"'; } ?>><a href="<?php echo PAGE_URL ?>"><i class="<?php echo PAGE_ICO ?>"></i> <?php echo PAGE ?></a></li>
					<?php } if(defined('SUBPAGE')) { ?>
					<li class="active"><a href="<?php echo SUBPAGE_URL ?>"><i class="<?php echo SUBPAGE_ICO ?>"></i> <?php echo SUBPAGE ?></a></li>
					<?php } ?>
				</ul>
			</div>
					
		</div>
	</div>
</div>
	
<!-- Content -->
<div id="da-content">
			
	<!-- Container -->
	<div class="da-container clearfix">
				
		<!-- Sidebar Separator do not remove -->
		<div id="da-sidebar-separator"></div>
				
		<!-- Sidebar -->
		<?php require_once 'sidebar.php' ?>
				
		<!-- Main Content Wrapper -->
		<div id="da-content-wrap" class="clearfix">
